package com.zimomo.exp2;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import java.util.Objects;

public class myCommandLineRunner implements CommandLineRunner {

    Environment env;

    public myCommandLineRunner(Environment env) {
        this.env = env;
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("自定义Spring Boot自动装配的CommandLineRunner。");

        System.out.println("生成一个随机字符串：".concat(Objects.requireNonNull(env.getProperty("random."))));
    }
}
